package com.wyp.demo.gallery;

import java.util.Comparator;

public class ComparatorFileDO implements Comparator<FileDO> {

	public int compare(FileDO object1, FileDO object2) {
		if(object1.isDir() == object2.isDir())
			return object1.getName().toLowerCase().compareTo(object2.getName().toLowerCase());
		else {
			if(object1.isDir())
				return object1.hashCode()*-1;
			else
				return object1.hashCode();
		}
	}

}
